package kr.saeildadim.androidexam_saeildamil.chapter8;

import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.Toast;

public class AnnoyHandleEx extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		View v = new View(this);
		//v.setOnTouchListener(listener);
		v.setOnTouchListener(new OnTouchListener() {
			
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				if(event.getAction()==MotionEvent.ACTION_DOWN){
					Toast.makeText(AnnoyHandleEx.this, "Point x"+event.getX()+"Point y"+event.getY()+"ACTION_DOWN", Toast.LENGTH_LONG).show();
					return true;
				}else if(event.getAction()==MotionEvent.ACTION_UP){
					Toast.makeText(AnnoyHandleEx.this, "ACTION_UP", Toast.LENGTH_LONG).show();
					return true;
				}
				return false;
			}
		});
		setContentView(v);
	}
	/*View.OnTouchListener listener = new OnTouchListener() {
		
		public boolean onTouch(View v, MotionEvent event) {
			if(event.getAction()==MotionEvent.ACTION_DOWN){
				Toast.makeText(AnnoyHandleEx.this, "Point x"+event.getX()+"Point y"+event.getY()+"ACTION_DOWN", Toast.LENGTH_LONG).show();
				return true;
			}else if(event.getAction()==MotionEvent.ACTION_UP){
				Toast.makeText(AnnoyHandleEx.this, "ACTION_UP", Toast.LENGTH_LONG).show();
				return true;
			}
			return false;
		}
	};*/ 
	
}
